<?php

class Application_Form_Updatemarker extends Zend_Form
{
	
        public function __construct()
	{
            
            $translate = new My_Action_Helper_Lang();
            
            $this->setName('update_form');
            parent::__construct();

            $name = new Zend_Form_Element_Text('name');
            $name->setLabel($translate->_('Name'))
                    ->setRequired(true)
                    ->addValidator('NotEmpty')
                    ->addFilter('StringTrim')
                    ->addFilter('StripTags');

            $address = new Zend_Form_Element_Text('address');
            $address->setLabel($translate->_('Address'))
                    ->setAttrib('id', 'start')
                    ->addFilter('StringTrim')
                    ->addFilter('StripTags');

            $category = new Zend_Form_Element_Select('type');
            $table = new Application_Model_Markers();
            //добавляем опции в форму
            $category->addMultiOption(0, $translate->_('Please select category'));
            $category->setLabel($translate->_('Category'));
            //массивом передаем значения в select
            foreach ($table->getAllCategories() as $table) {
                $category->addMultiOption($table['name'], $table['name']);
            }

            $description = new Zend_Form_Element_Textarea('description');
            $description->setLabel($translate->_('Description'))
                    ->addFilter('StringTrim')
                    ->addFilter('StripTags');
            
 

            $imageform = new Zend_Form_Element_File('imageform');
            $imageform->setLabel('Добавить изображение')
                    ->setAttrib('id', 'photoimg');

  
            $submit = new Zend_Form_Element_Button('save');
            $submit->setLabel($translate->_('Update'))
                   ->setAttrib('class', 'button');


            $this->addElements(array($name, $address, $category, $description, $submit));

	}
}